package deuxieme_partie;

import java.util.LinkedList;

public class Main {


	/**
	 * Main de test
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		LinkedList<Integer> l1 = new LinkedList<Integer>();
		l1.addLast(9);
		l1.addLast(2);
		l1.addLast(1);
		
		LinkedList<Integer> l2 = new LinkedList<Integer>();
		l2.addLast(9);
		
		GrandEntier a = new GrandEntier(l2);
					
		GrandEntier b = new GrandEntier(l1);
		
		System.out.print(a.toString() + "+" + b.toString() + "=");
		
		GrandEntier c = a.add(b);
		System.out.println(c.toString());
		
		LinkedList<Integer> l3 = new LinkedList<Integer>();
		l3.addLast(0);
		l3.addLast(0);
		l3.addLast(9);
		l3.addLast(3);
		l3.addLast(0);
		
		GrandEntier d = new GrandEntier(l3);
		
		System.out.println(c + "==" + d + " = " + c.equals(d));
		
		LinkedList<Integer> l4 = new LinkedList<Integer>();
		LinkedList<Integer> l5 = new LinkedList<Integer>();
		
		l4.addLast(6);
		l4.addLast(2);

		l5.addLast(4);
		l5.addLast(4);
		
		GrandEntier e = new GrandEntier(l4);
		GrandEntier f = new GrandEntier(l5);
		
		System.out.println(e + "*" + f + " = " + f.multiply(e));
		System.out.println(a + "*" + b + " = " + a.multiply(b));
		System.out.println(b + "*" + c + " = " + b.multiply(c));
		
		LinkedList<Integer> l6 = new LinkedList<Integer>();
		LinkedList<Integer> l7 = new LinkedList<Integer>();
		
		l6.addLast(2);
		l6.addLast(6);
		
		l7.addLast(3);
		l7.addLast(4);
		
		GrandEntier g = new GrandEntier(l6);
		GrandEntier h = new GrandEntier(l7);
		
		System.out.println(g + "*" + h + " = " + g.multiply(h));
		
		LinkedList<Integer> l8 = new LinkedList<Integer>();
		LinkedList<Integer> l9 = new LinkedList<Integer>();
		
		l8.addLast(3);
		l8.addLast(7);
		
		l9.addLast(8);
		l9.addLast(7);
		
		GrandEntier i = new GrandEntier(l8);
		GrandEntier j = new GrandEntier(l9);
		
		System.out.println(i + "*" + j + " = " + i.multiply(j));
		
		LinkedList<Integer> l10 = new LinkedList<Integer>();
		LinkedList<Integer> l11 = new LinkedList<Integer>();
		
		l10.addLast(1);
		l10.addLast(2);
		
		l11.addLast(2);
		l11.addLast(5);
		
		GrandEntier k = new GrandEntier(l10);
		GrandEntier l = new GrandEntier(l11);
		
		System.out.println(k + "*" + l + " = " + k.multiply(l));
		
		GrandEntier m = new GrandEntier(l10); m.getTerms().addAll(l8);
		GrandEntier n = new GrandEntier(l11); n.getTerms().addAll(l9);
		
		System.out.println(m + "*" + n + " = " + m.multiply(n));
		
		// Karatsuba
		//
		System.out.println("\nKaratsuba : ");
		System.out.println(e + "*" + f + " = " + f.multiplyFast(e));
		System.out.println(g + "*" + h + " = " + g.multiplyFast(h));
		System.out.println(i + "*" + j + " = " + i.multiplyFast(j));
		System.out.println(k + "*" + l + " = " + k.multiplyFast(l));
		System.out.println(m + "*" + n + " = " + m.multiplyFast(n));
		
		System.out.println("\n");
		
		/*try 
		{
			GrandEntier.compareSimpleWithFast(1);
		} 
		catch (Exception ex) 
		{
			// TODO Auto-generated catch block
			ex.printStackTrace();
		}*/
	}


}
